/*oblem Id:2608  User Id:Latex 
Memory:24K  Time:0MS
Language:C++  Result:Accepted

Source 
*/
#include<stdio.h>
#include<string.h>
#include<math.h>

char in[30];
char code[30]={"01230120022455012623010202"};

int main()
{
	int i;
	int len;
	char pre='\0';

	while(scanf("%s",in)==1)
	{
		len=strlen(in);
		pre='\0';
		for(i=0;i<len;i++)
		{
			if(code[in[i]-'A']!=pre)
			{
				pre=code[in[i]-'A'];
				if( code[in[i]-'A']!='0')
					printf("%c",code[in[i]-'A']);	
			}
		}
		printf("\n");
	
	}
	

	return 0;
}


